<?php
/*
 * 基础控制器
 */
abstract class Controller{
    public function __construct() {
        $this->initCharset();
        $this->initSession();
    }
    //加载函数库的方法
    protected function loadFun($fun_name){
        require HELP_PATH.$fun_name.'.fun.php';
    }
    //初始化字符编码
    private function initCharset(){
        header('Content-Type:text/html;charset=utf-8');
    }
    //session入库
    private function initSession(){
        new SessionLib();
    }
    
    //跳转的方法
    protected function jump($url,$info='',$time=3){
        if($info==''){
            header("location:$url");
        }else{
            echo <<<jump
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<meta http-equiv="refresh" content="{$time};URL={$url}" />
<style type="text/css">
#info{
	font-size:14px;
	text-align:center;
	width:200px;
	line-height:100px;
	border:#000 solid 1px;
	background-color:#CCC;
	margin:100px auto;
	color:#F00;
}
</style>
</head>

<body>
<div id="info">{$info}</div>
</body>
</html>      
jump;
        }
        exit;
    }
}
